package dev.ece.core.sprite;

import dev.ece.core.cells.model.base.SquareUI;
import dev.ece.core.shader.DefaultTextureShader;
import dev.ece.core.texture.Texture;
import dev.ece.util.tools.Camera;

public class SquareComponent extends Component<Float, SquareUI<Float>> {


	/**
	 * 
	 */
	private static final long serialVersionUID = -6418872281840088429L;
	
	private DefaultTextureShader shader;
	
	private Texture texture;
	
	public SquareComponent(Texture texture, float width, float height) {
		super(new SquareUI<Float>(width, height));
		this.texture = texture;
		this.shader = DefaultTextureShader.getDefaultTextureShader();
	}

	@Override
	public void onRender(Camera camera) {
		shader.glUseProgram();
		shader.glModelViewProjectMatrix();
		shader.glTexture(texture);
		super.onRender(camera);
	}

	public float getWidth() {
		return this.getUi().getWidth();
	}
	
	public float getHeight() {
		return this.getUi().getHeight();
	}
	
}
